package com.myMinistry.provider;

import android.provider.BaseColumns;

import com.myMinistry.provider.MinistryDatabase.Tables;

public class MinistryContract {
	interface TimeColumns {
		/** PublisherID to link to publishers table. */
		String PUBLISHER_ID = "publisherID";
		/** HouseholderID to link to householders table. */
		String HOUSEHOLDER_ID = "householderID";
		/** EntryTypeID to link to entryType table. */
		String ENTRY_TYPE_ID = "entryType";
		/** Date of the time entry. */
		String DATE = "entryDate";
		/** Start time of the entry. */
		String TIME_START = "startTime";
		/** End time of the entry. */
		String TIME_END = "endTime";
		/** Duration of hours for the entry. */
		String TOTAL_HOURS = "total";
		/** Count of return visits that are not linked to a householder. */
		String RETURN_VISITS = "returnVisits";
	}
	
	interface RolloverColumns {
		/** PublisherID to link to publishers table. */
		String PUBLISHER_ID = "publisherID";
		/** Date of the roll over. */
		String DATE = "date";
		/** Amount of time to roll over. */
		String MINUTES = "minutes";
	}
	
	interface EntryTypeColumns {
		/** PublisherID to link to publishers table. */
		String PUBLISHER_ID = "publisherID";
		/** Name of the entry type. */
		String NAME = "name";
		/** Active flag. */
		String ACTIVE = "isActive";
		/** Bible Study flag. */
		String STUDY = "isStudy";
		/** Return Visit flag. */
		String RV = "isReturnVisit";
		/** RBC flag. */
		String RBC = "isRBC";
		/** Sorting. */
		String SORT_ORDER = "sortOrder";
	}

	interface HouseholderColumns {
		/** PublisherID to link to publishers table. */
		String PUBLISHER_ID = "publisherID";
		/** Name of the householder. */
		String NAME = "name";
		/** Address. */
		String ADDR = "address";
		/** URI of phones contacts */
		String URI_ID = "uriID";
		/** Phone mobile. */
		String MOBILE_PHONE = "phoneMobile";
		/** Phone home. */
		String HOME_PHONE = "phoneHome";
		/** Phone work. */
		String WORK_PHONE = "phoneWork";
		/** Phone other. */
		String OTHER_PHONE = "phoneOther";
		/** Active flag. */
		String ACTIVE = "isActive";
		/** Active flag. */
		String STAR = "isStar";
		/** EntryTypeID to link to entryType table. */
		String ENTRY_TYPE_ID = "entryType";
		/** Bible Study flag. */
		String STUDY = "isStudy";
		/** Return Visit flag. */
		String RV = "isReturnVisit";
	}

	interface LiteratureColumns {
		/** PublisherID to link to publishers table. */
		String PUBLISHER_ID = "publisherID";
		/** Name of the literature. */
		String NAME = "name";
		/** LiteruateTypeID to link to literatureTypes tables. */
		String TYPE_OF_LIERATURE_ID = "typeID";
		/** Active flag. */
		String ACTIVE = "isActive";
		/** Count weight of literature. */
		String WEIGHT = "countWeight";
		/** Sort order. */
		String SORT_ORDER = "sortOrder";
	}

	interface LiteratureTypeColumns {
		/** PublisherID to link to publishers table. */
		String PUBLISHER_ID = "publisherID";
		/** Name of the literature. */
		String NAME = "name";
		/** Active flag. */
		String ACTIVE = "isActive";
		/** Sort order. */
		String SORT_ORDER = "sortOrder";
	}

	interface PublisherColumns {
		/** Name of the publisher. */
		String NAME = "name";
		/** Active flag. */
		String ACTIVE = "isActive";
	}
	
	interface LiteraturePlacedColumns {
		/** PublisherID to link to publishers table. */
		String PUBLISHER_ID = "publisherID";
		/** LiteratureID to link to literatureNames table. */
		String LITERATURE_ID = "litNameID";
		/** HouseholderID to link to householders table. */
		String HOUSEHOLDER_ID = "householderID";
		/** TimeID to link to times table. */
		String TIME_ID = "timeID";
		/** Number of literatures placed. */
		String COUNT = "count";
		/** Month of magazines. */
		String MAG_MONTH = "magMonth";
		/** Year of magazines. */
		String MAG_YEAR = "magYear";
		/** Date of the literature placed. */
		String DATE = "datePlaced";
	}
	
	interface PioneeringColumns {
		/** PublisherID to link to publishers table. */
		String PUBLISHER_ID = "publisherID";
		String TYPE_ID = "typeID";
		String YEAR_START = "yearStarting";
		String MONTH_START = "monthStarting";
		String MONTHLY_HOURS = "monthlyHours";
	}
	
	interface Qualified {
		String LITERATURE_ID = Tables.LITERATURE + "." + Literature._ID;
		String LITERATURE_NAME = Tables.LITERATURE + "." + Literature.NAME;
		String LITERATURE_TYPE_ID_LINK = Tables.LITERATURE + "." + Literature.TYPE_OF_LIERATURE_ID;
		String LITERATURE_WEIGHT = Tables.LITERATURE + "." + Literature.WEIGHT;
		String TYPE_OF_LITERATURE_ID = Tables.TYPES_OF_LIERATURE + "." + LiteratureType._ID;
		String PLACED_LITERATURE_PUBLISHER_ID = Tables.PLACED_LITERATURE + "." + LiteraturePlaced.PUBLISHER_ID;
		String PLACED_LITERATURE_DATE = Tables.PLACED_LITERATURE + "." + LiteraturePlaced.DATE;
		String PLACED_LITERATURE_ID = Tables.PLACED_LITERATURE + "." + LiteraturePlaced._ID;
		String PLACED_LITERATURE_HOUSEHOLDER_ID = Tables.PLACED_LITERATURE + "." + LiteraturePlaced.HOUSEHOLDER_ID;
		String PLACED_LITERATURE_COUNT = Tables.PLACED_LITERATURE + "." + LiteraturePlaced.COUNT;
		String PLACED_LITERATURE_LIT_ID = Tables.PLACED_LITERATURE + "." + LiteraturePlaced.LITERATURE_ID;
		String PLACED_LITERATURE_TIME_ID = Tables.PLACED_LITERATURE + "." + LiteraturePlaced.TIME_ID;
		String ENTRY_TYPE_ID = Tables.ENTRY_TYPES + "." + EntryType._ID;
		String TIME_ID = Tables.TIMES + "." + Time._ID;
		String TIME_PUBLISHER_ID = Tables.TIMES + "." + Time.PUBLISHER_ID;
		String TIME_HOUSEHOLDER_ID = Tables.TIMES + "." + Time.HOUSEHOLDER_ID;
		String TIME_ENTRY_TYPE_ID = Tables.TIMES + "." + Time.ENTRY_TYPE_ID;
		String TIME_DATE = Tables.TIMES + "." + Time.DATE;
		String TIME_TIME_START = Tables.TIMES + "." + Time.TIME_START;
		String TIME_TIME_END = Tables.TIMES + "." + Time.TIME_END;
		String TIME_TOTAL_HOURS = Tables.TIMES + "." + Time.TOTAL_HOURS;
		String TIME_RVs = Tables.TIMES + "." + Time.RETURN_VISITS;
		String ENTRY_TYPE_RBC = Tables.ENTRY_TYPES + "." + EntryType.RBC;
		String ENTRY_TYPE_NAME = Tables.ENTRY_TYPES + "." + EntryType.NAME + " AS " + Tables.ENTRY_TYPES + EntryType.NAME;
		String HOUSEHOLDER_NAME = Tables.HOUSEHOLDERS + "." + Householder.NAME + " AS " + Tables.HOUSEHOLDERS + Householder.NAME;
		String HOUSEHOLDER_ID = Tables.HOUSEHOLDERS + "." + Householder._ID;
	}
	
	interface Joins {
		String LITERATURE_JOIN_PLACED_LITERATURE = " INNER JOIN " + Tables.LITERATURE + " ON " + Qualified.LITERATURE_ID + " = " + Qualified.PLACED_LITERATURE_LIT_ID;
		String TYPE_LITERATURE_JOIN_LITERATURE = " INNER JOIN " + Tables.TYPES_OF_LIERATURE + " ON " + Qualified.TYPE_OF_LITERATURE_ID + " = " + Qualified.LITERATURE_TYPE_ID_LINK;
	}
	
	/** Times are an entry of time a person was out in some type of ministry service. */
	public static class Time implements TimeColumns, BaseColumns { }
	
	/** Roll overs are the remainder of minutes for a month of time. */
	public static class Rollover implements RolloverColumns, BaseColumns { }
	
	/** Entry types for the time entries. */
	public static class EntryType implements EntryTypeColumns, BaseColumns {
		public static final int ROLLOVER_ID = 1;
		public static final String QUALIFIED_NAME = Tables.ENTRY_TYPES + EntryType.NAME;
		/** Default "ORDER BY" clause. */
		public static final String DEFAULT_SORT = EntryTypeColumns.ACTIVE + " DESC," + EntryTypeColumns.NAME;
	}
	
	/** Householders to use. */
	public static class Householder implements HouseholderColumns, BaseColumns {
		public static final String QUALIFIED_NAME = Tables.HOUSEHOLDERS + Householder.NAME;
		/** Default "ORDER BY" clause. */
		public static final String DEFAULT_SORT = HouseholderColumns.ACTIVE + " DESC," + HouseholderColumns.NAME;
	}
	
	/** Publishers to use. */
	public static class Publisher implements PublisherColumns, BaseColumns {
		/** Default "ORDER BY" clause. */
		public static final String DEFAULT_SORT = PublisherColumns.ACTIVE + " DESC, " + PublisherColumns.NAME;
	}
	
	/** Literature available. */
	public static class Literature implements LiteratureColumns, BaseColumns {
		/** Default "ORDER BY" clause. */
		public static final String DEFAULT_SORT = LiteratureColumns.ACTIVE + " DESC," + LiteratureColumns.NAME;
	}
	
	/** Literature types like books or magazines. */
	public static class LiteratureType implements LiteratureTypeColumns, BaseColumns {
		/** Default "ORDER BY" clause. */
		public static final String DEFAULT_SORT = LiteratureType.ACTIVE + " DESC, " + LiteratureType.NAME;
	}
	
	/** Placed literature for time entries. */
	public static class LiteraturePlaced implements LiteraturePlacedColumns, BaseColumns { }
	
	/** Roll overs are the remainder of minutes for a month of time. */
	public static class Pioneering implements PioneeringColumns, BaseColumns { }
	
	private MinistryContract() { }
}